package pl.diagnoser.server.persistance.map;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "D_APP")
public class App implements Serializable {

	private static final long serialVersionUID = 1L;
	private Long appId;
	private String appName;
	private int isActive;
	private int isSearchMode;
	private List<AttributeDict> attributes = new ArrayList<AttributeDict>();
	
	public App() {}
	public App( Long appId, String appName, int isActive, int isSearchMode ) {
		this.appId = appId;
		this.appName = appName;
		this.isActive = isActive;
		this.isSearchMode = isSearchMode;
	}
	
	@Id
	@GeneratedValue
	@Column( name = "APP_ID", unique = true, nullable = false, length = 10 )
	public Long getAppId() {
		return this.appId;
	}
	
	public void setAppId(Long appId) {
		this.appId = appId;
	}
	
	@Column( name = "APP_NAME", unique = true, nullable = false, length = 255 )
	public String getAppName() {
		return this.appName;
	}
	
	public void setAppName(String appName) {
		this.appName = appName;
	}
	
	@Column( name = "IS_ACTIVE", unique = false, nullable = false, length = 1 )
	public int getIsActive() {
		return this.isActive;
	}
	
	public void setIsActive(int isActive) {
		this.isActive = isActive;
	}

	@Column( name = "IS_SEARCH_MODE", unique = false, nullable = false, length = 1 )
	public int getIsSearchMode() {
		return this.isSearchMode;
	}
	
	public void setIsSearchMode(int isSearchMode) {
		this.isSearchMode = isSearchMode;
	}

	@OneToMany( mappedBy = "app" )
	public List<AttributeDict> getAttributes() {
		return attributes;
	}
	
	public void setAttributes(List<AttributeDict> attributes) {
		this.attributes = attributes;
	}
}
